package com.ja.subclass.mapper;

import com.ja.subclass.pojo.SubClass;
import com.ja.subclass.pojo.SubClassSelect;
import com.ja.subclass.pojo.SubClassVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by 11936 on 2019/4/25.
 */

@Mapper
public interface SubMapper {
    @Insert("insert into subclass(code,name,remark,status) values(#{code},#{name},#{remark},#{statusName})")
    void addSubClass(SubClassVo subClassVo);

    @Update("update subclass set code=#{code},name=#{name},remark=#{remark},status=#{statusName} where id=#{id}")
    int updateSubClass(SubClassVo subClassVo);

    @Select("select id from subclass where name=#{name}")
    List<SubClassVo> queryByName(SubClassVo subClassVo);

    @Update("update subclass set status=#{statusName} where id=#{id}")
    int updateStatus(SubClassVo subClassVo);

    @Select("select * from subclass where code=#{code}")
    List<SubClass> queryByCode(SubClassVo subClassVo);

    int countByCNS(SubClassSelect subClassSelect);

    List<SubClass> queryLimit(SubClassSelect subClassSelect);
}
